don't install an empty icon_set if none of the image files could be found
authorSven Neumann <sven@gimp.org>
Tue, 29 Jan 2002 12:24:02 +0000 (12:24 +0000)
committerSven Neumann <neo@src.gnome.org>
Tue, 29 Jan 2002 12:24:02 +0000 (12:24 +0000)
2002-01-29  Sven Neumann  <sven@gimp.org>

* gtk/gtkrc.c: don't install an empty icon_set if none of the image
files could be found in the pixmap_path (bug #69398).

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkrc.c

index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 0ca6226039bdb4647cf58c80f1a7f248fd56bbda..ef196873a76ba423b3ab8f8ae36a1645fc279bec 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-29  Sven Neumann  <sven@gimp.org>
+
+       * gtk/gtkrc.c: don't install an empty icon_set if none of the image
+       files could be found in the pixmap_path (bug #69398).
+       
 2002-01-29  Sven Neumann  <sven@gimp.org>
 
        * gdk/x11/gdkimage-x11.c (_gdk_x11_copy_to_image): fixed a segfault
index 1686324916c4a5ed239aa84c1c7fb50ab1431da3..a4f64c3011a8f7c2f1825d0e0b43335fa51b79f4 100644 (file)
@@ -2769,8 +2769,9 @@ gtk_rc_find_pixmap_in_path (GtkSettings  *settings,
     }
   
   if (scanner)
-    g_warning (_("Unable to locate image file in pixmap_path: \"%s\" line %d"),
-              pixmap_file, scanner->line);
+    g_scanner_warn (scanner, 
+                    _("Unable to locate image file in pixmap_path: \"%s\""),
+                    pixmap_file);
   else
     g_warning (_("Unable to locate image file in pixmap_path: \"%s\""),
               pixmap_file);
@@ -3431,7 +3432,8 @@ gtk_rc_parse_stock_id (GScanner    *scanner,
 static guint
 gtk_rc_parse_icon_source (GtkRcContext   *context,
                          GScanner       *scanner,
-                          GtkIconSet     *icon_set)
+                          GtkIconSet     *icon_set,
+                          gboolean       *icon_set_valid)
 {
   guint token;
   GtkIconSource *source;
@@ -3457,7 +3459,8 @@ gtk_rc_parse_icon_source (GtkRcContext   *context,
     }
 
   /* We continue parsing even if we didn't find the pixmap so that rest of the
-   * file is read, even if the syntax is bad
+   * file is read, even if the syntax is bad. However we don't validate the 
+   * icon_set so the caller can choose not to install it.
    */
   token = g_scanner_get_next_token (scanner);
 
@@ -3589,7 +3592,10 @@ gtk_rc_parse_icon_source (GtkRcContext   *context,
 
  done:
   if (gtk_icon_source_get_filename (source))
-    gtk_icon_set_add_source (icon_set, source);
+    {
+      gtk_icon_set_add_source (icon_set, source);
+      *icon_set_valid = TRUE;
+    }
   gtk_icon_source_free (source);
   
   return G_TOKEN_NONE;
@@ -3602,6 +3608,7 @@ gtk_rc_parse_stock (GtkRcContext   *context,
                     GtkIconFactory *factory)
 {
   GtkIconSet *icon_set = NULL;
+  gboolean icon_set_valid = FALSE;
   gchar *stock_id = NULL;
   guint token;
   
@@ -3633,7 +3640,8 @@ gtk_rc_parse_stock (GtkRcContext   *context,
       if (icon_set == NULL)
         icon_set = gtk_icon_set_new ();
       
-      token = gtk_rc_parse_icon_source (context, scanner, icon_set);
+      token = gtk_rc_parse_icon_source (context, 
+                                        scanner, icon_set, &icon_set_valid);
       if (token != G_TOKEN_NONE)
         {
           g_free (stock_id);
@@ -3652,7 +3660,7 @@ gtk_rc_parse_stock (GtkRcContext   *context,
         }
     }
 
-  if (icon_set)
+  if (icon_set && icon_set_valid)
     {
       gtk_icon_factory_add (factory,
                             stock_id,